This invention relates to communications between electronic devices. More particularly, this invention relates to a system that a first device uses to determine the baud rate and protocol that a second device uses to communicate with the first device and that sets the first device to the used baud rate and protocol. Still more particularly, this invention relates to a system in a first UART device for determining a baud rate, frame and protocol that a second UART device uses to communicate and for setting the first device to communicate at the determined baud rate, frame and protocol.
In the process control industry, it is common for multiple electronic devices to communicate the share data. The electronic devices must share data to provide control functions in a process. For example, a first electronic device may measure the flow of a material through a pipeline and a second device may control a valve which regulates the flow of material. In order to regulate the flow of material, the first device must transfer flow rate data to the second device which in turn opens and closes the valve to regulate the flow of material.
It is a problem that different devices may communicate using different baud rates and different protocols. For the present discussion, frame types, baud rate, framing, and protocols are referred to as xe2x80x9cProtocol Parameters.xe2x80x9d For purposes of this discussion, the baud rate is the amount of bits per unit of time that are transferred by a device. The frame type is the manner in which message packets are formatted to transfer data between two devices. The protocol is the manner in which groups of message packets are organized along with xe2x80x9cwhenxe2x80x9d devices may send/receive packets in order to transfer data between two devices. If two devices do not communicate using the same Protocol Parameters, a first device will not receive correct data from the second device.
To facilitate communication between devices, most devices include a Universal Asynchronous Receiver Transmitter (UART). A UART is an interface that provides communication between devices. In control devices, protocols such as Modbus use UARTS to communicate. UARTs may also communicate at any one of a number of baud rates and framing types. In the past, if it were possible that a first device could be connected to other devices that communicate at one of any number of xe2x80x9cprotocol/UART parameters,xe2x80x9d the first device had to be programmed manually to communicate with the proper xe2x80x9cprotocol/UART parameters.xe2x80x9d This requires the user to properly program the UART in order for the device communicate with another device.
The ability to make a device that is capable of communicating with many different devices using different Protocol Parameters is a particular problem for makers of Coriolis flowmeters. A Coriolis mass flowmeter measures mass flow and other information of materials flowing through a pipeline in the manner described by U.S. Pat. No. 4,491,025 issued to J. E. Smith, et al. of Jan. 1, 1985 and Re. 31,450 to J. E. Smith of Feb. 11, 1982. A Coriolis mass flowmeter has one or more flow tubes of a curved or straight configuration. Each flow tube configuration in a Coriolis mass flowmeter has a set of natural vibration modes, which may be of a simple bending, torsional, radial, or coupled type. Each flow tube is driven to oscillate at resonance in one of these natural modes. The natural vibration modes of the vibrating, material filled systems are defined in part by the combined mass of the flow tubes and the material within the flow tubes. Material flows into the flowmeter from a connected pipeline on the inlet side of the flowmeter. The material is then directed through the flow tube or flow tubes and exits the flowmeter to a pipeline connected on the outlet side.
A driver applies a vibrational force to the flow tube. The force causes the flow tube to oscillate. When there is no material flowing through the flowmeter, all points along a flow tube oscillate with an identical phase. As a material begins to flow through the flow tube, Coriolis accelerations cause each point along the flow tube to have a different phase with respect to other points along the flow tube. The phase on the inlet side of the flow tube lags the driver, while the phase on the outlet side leads the driver. Sensors are placed at two different points on the flow tube to produce sinusoidal signals representative of the motion of the flow tube at the two points. A phase difference of the two signals received from the sensors is calculated in units of time. The phase difference between the two sensor signals is proportional to the mass flow rate of the material flowing through the flow tube or flow tubes.
The sensors transmit the sinusoidal signals to a signal conditioner. The signal conditioner generates parameter signals that indicate properties of the material flowing through the flowmeter. The signal conditioner also generates a drive signal applied to the driver to vibrate the flow tubes. The parameter signals are then transmitted to a host system which provides the desired properties to a user.
Different host systems may transfer data in one of several Protocol Parameters. The signal conditioner must be able to recognize the Protocol Parameters used by the host system to communicate. The signal conditioner must then be configured to communicate in the recognized Protocol Parameters to communicate with the host system. Therefore, the makers of Coriolis Flowmeters desire a system that would allow a signal conditioner to communicate with different types of host systems without the need of manual programming.
The above and other problems are solved and an advance in the art is made by a system for setting Protocol Parameters for transmission in a device in accordance with this invention. One advantage of a system in accordance with this invention is that a device automatically determines the Protocol Parameters being used and sets communication in the determined Protocol Parameters being used. This eliminates reliance on a user to set the communication Protocol Parameters properly for each device making communication more reliable. Furthermore, a system in accordance with the present invention makes the determination of protocol parameters being used without losing data and without the use of special frames. Therefore, existing devices devices may communicate with a device implementing a system in accordance with this invention without modification.
A first or remote device executing the system in accordance with this invention has a processing unit connected to a bus that connects the remote device to a second or host device. A remote device is a device that provides a service or data to a host device to allow the host device to perform a function. A host device is a device that determines the Protocol Parameters used to transmit data, receives data from the remote device and performs a control function using the received data.
When the first device is connected to the second device, the second device transmits signals indicating data to the first device. In accordance with this invention, the first device receives the signals. The baud rate of bits in the received signals is detected by the first device. The protocol and framing of the bits received is then determined by the first device. The first device is then set to communicate in the determined Protocol Parameters.
One manner in which the baud rate may be detected is by determining whether a level transition between two bits is received in a predetermined number of samples. If the transition bit is not detected in a certain number of samples, then the system may determine the baud rate is less than or equal to n divided by 8. One manner in which the system may determine whether a transition occurs is by template matching.
If the transition bit is not received in a certain number of samples, the first device determines that the baud rate must be between n and n/4. Therefore, template matching may be performed for, patterns of protocols and framing for baud rates between n and n/4.
Template matching is performed in the following manner in accordance with the present invention. The first device reads one of a plurality of templates for Protocol Parameters supported by the first device. The samples received are then read from a buffer. The read template is then compared to the read samples. When a template matches the samples, the first device is set to communicate at the Protocol Parameters of the template.
A first aspect of this invention is a method for a remote device to establish communication with a host device in the following manner. The remote device receives samples of signals from the host device. A baud rate of the signals from is detected by the remote device from the samples. The remote device then determines from the samples a protocol and framing being used by the host device to communicate. The remote device is then set to communicate with the host device using the determined Protocol Parameters.
A second aspect of this invention is that baud rate is detected by determining whether a level transition occurs between two bits received within a certain number of samples.
A third aspect of this invention is adjusting a sample rate responsive to the level transition between two bits not being received within the certain number of samples.
A fourth aspect of this invention is that the baud rate is determined to be less than or equal to n divided by 8 responsive to a determination that the level transition between two bits is not received within the certain number of samples.
A fifth aspect of this invention is performing protocol template matching for baud rates of n divided 8 and less responsive to a determination that the baud rate is less than or equal to n divided by 8.
A sixth aspect of this invention is that the baud rate is determined to be between n and n/4 responsive to a determination that the level transition between two bits is not received within the certain number of samples.
A seventh aspect of this invention is that the determination of the protocol and framing may be completed by performing protocol template matching for each supported baud rate between n and n/4 in response to a determination that the baud rate is between n and n/4.
An eighth aspect of this invention is that a determination of the protocol and framing may be completed by performing protocol template matching between the samples and templates of known bits in supported protocols.
A ninth aspect of this invention is that the performing of protocol template matching may be done in the following manner. The remote device reads one of a plurality of protocol templates and then reads the samples of the signals. The samples and template are compared and the remote device determines the signals are being transmitted in a protocol of the one of said plurality of protocol templates responsive to a match of the one of said plurality of protocol templates and the samples of the signals.